﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
public partial class FontTest : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int width = 400, hight = 250;
        using (Bitmap image=new Bitmap(width,hight))
        {
            using (Graphics g=Graphics.FromImage(image))
            {
                using (Brush brush=new SolidBrush(Color.Black))
                {
                    //Font font = new Font("宋体", 12,FontStyle.Regular);
                    //Font font1 = new Font("Arial", 12,FontStyle.Regular);
                    Font font = new Font("宋体", 12,FontStyle.Italic);
                    Font font1 = new Font("Arial", 12);
                    g.DrawString("宋体 12号",font,brush,20,20);
                    g.DrawString("Arial 12号",font,brush,20,25+font.Height);
                    image.Save(this.Server.MapPath("String.Png"),System.Drawing.Imaging.ImageFormat.Png);
                    Image1.ImageUrl = "String.Png";
                }
            }//end
        }//end
    }//end
}